/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1630920617616_8181';

    // add your middleware config here
    config.middleware = ["auth"];

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };
    config.security = {
        csrf: {
            enable: false,
        }
    };

    config.cluster = {
        listen: {
          path: '',
          port: 30003,
          hostname: '0.0.0.0',
        }
    };


    config.sequelize = {
        dialect: 'mysql',
        host: '127.0.0.1',
        port: 3306,
        username: 'root',
        password: 'root',
        database: 'moyu_game',
        logging: false,

        define: {
            freezeTableName: true,
            timestamps: true,//这里 
            createdAt: 'create_time',
            updatedAt: 'update_time',
            deletedAt: false,
            paranoid: false
        },
        timezone: "+08:00",
        dialectOptions: { 
            charset: 'utf8mb4',
            dateStrings: true,
            typeCast: true
        }
    };
    config.redis= {
        client: {
          port: 6379,
          host: '127.0.0.1',
          password: 'moyu123',
          db: 0,
        },
    };


    return {
        ...config,
        ...userConfig,
    };
};
